package com.example.test.启动线程.公平非公平;

public class Syn {
    // 非公平锁
    public static void main(String[] args) {
        ABC abc = new ABC();
        new Thread(abc).start();
        new Thread(abc).start();
        new Thread(abc).start();
    }

}

class ABC implements Runnable {
    @Override
    public void run() {
        while (true) {
            synchronized (this) {
                try {
                    Thread.sleep(1000);
                    System.out.println(Thread.currentThread().getName());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
